<template>
	<view class="content">
		<u-toast ref="uToast"></u-toast>
		<view class="personal">
			<u-cell-group>
				<u-cell :title="item.name" isLink v-for="item in malList" :url="item.url" :key="item.id"></u-cell>
			</u-cell-group>
		</view>
		<view class="mar_bottom btn">
			<u-button text="退出登录" shape="circle" type="primary" @click="confirm"></u-button>
		</view>
	</view>
</template>

<script>
	import {
		logout
	} from '@/api/login.js'
	export default {
		data() {
			return {
				malList: [{
					name: '账号管理',
					id: 0
				}, {
					name: '密码修改',
					id: 1,
					url: '/pages/changPassword/index'
				}]
			}
		},
		methods: {
			//退出登录
			confirm() {
				let that = this
				uni.showModal({
					title: '提示',
					content: '是否要退出登录',
					success: function(res) {
						if (res.confirm) {
							that.getLogout()
						}
					}
				})
			},
			getLogout() {
				logout().then(res => {
					uni.reLaunch({
						url: "/pages/login/index",
						success: function(res) {
							uni.clearStorageSync();
						}
					});
				})
			}
		}
	}
</script>

<style scoped>
	.content /deep/ .u-cell__body {
		padding: 14px;
	}
</style>
<style lang="scss" scoped>
	.content {

		.personal {
			background-color: #FFFFFF;
		}

		.btn {
			margin-bottom: 20rpx;
			margin-top: 40rpx;
			padding: 40rpx;
		}
	}
</style>
